home *** CD-ROM | disk | FTP | other *** search
- /*
- File: TApplication.h
-
- Contains: TApplication: a class for applications with no document
-
- Written by: Arno Gourdol
-
- Copyright: © 1993-1996 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #pragma once
-
- #include <Quickdraw.h>
- #include <AppleEvents.h>
-
- #include "TEnvironment.h"
- #include "CWindows.h"
-
- class TApplication
- {
- public:
- // constructor
- TApplication(OSType signature);
-
- // destructor
- virtual ~TApplication();
-
- virtual void Run(void); // Starts the app
- virtual Boolean QuitRequested(void); // Can we quit?
- virtual void Quit(); // Clean-up, get ready to quit
- virtual void AppActivated(Boolean active); // Change the activation state (dim controls, etc...)
- virtual void AboutRequested(void); // Display About box
-
- virtual void Pulse(void); // Idle event
-
- // Menu commands
- virtual void MenusWillShow(void); // Update the menus
- virtual Boolean MenuCommand(short menu,
- short item);
-
- static TApplication* gApplication; // The running application
- Boolean fFinished; // True if the application must quit
-
- // Environment
- TEnvironment fEnvironment; // Info about what system software is available
-
- protected:
- void MainEventLoop(void); // Get and process events
-
- // Update and Drawing
- virtual void Event(const EventRecord& evt); // Process an event (and dispatch)
-
- // Apple Events
- virtual void InitAppleEvents(void);
- virtual OSErr Event(AppleEvent *messagein, AppleEvent *reply, OSType eventID);
-
- // UI behavior
- Boolean DoZoomWindow(short part); // ZoomWindow in or out
- Boolean DoResizeWindow(struct EventRecord *evt); // Resize the window
- void DoUpdateDocument(RgnHandle area); // Update the area region of the content of the document
-
- // Events
- UInt32 fSleepTime; // Background sleep time passed to WNE
-
- // State of the application
- Boolean fActive; // True if window is active
-
-
- OSType fSignature; // Application signature
-
- private:
- void HandleMenuCommand(long command); // Dispatch menu commands
- static pascal Boolean IdleProc(EventRecord *event, long *sleep, RgnHandle *mouseRgn);
- static pascal OSErr HandleAppleEvent(AppleEvent *messagein, AppleEvent *reply, OSType eventID);
- };
-